package com.limit.control.admin.validate;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import com.limit.model.AdSlide;
import com.limit.utils.PropertiesUtil;

public class SlideValidator extends Validator {

	@Override
	protected void validate(Controller c) {
		c.getFile("image_path",PropertiesUtil.load("slide_path"));
		this.validateRequired("adSlide.name", "nameError", "名称不能为空！");
		this.validateRequired("adSlide.href", "hrefError", "外链不能为空！");
//		this.validateRequired("adSlide.image_path", "image_pathError", "图片不能为空！");
		this.validateRequired("adSlide.sort_id", "sort_idError", "排序号不能为空！");
		this.validateRequired("adSlide.disable", "disableError", "是否禁用不能为空！");
		
	}

	@Override
	protected void handleError(Controller c) {
		c.keepModel(AdSlide.class);
        c.render("slide_view.html");
	}

}
